home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / NLoad / LoadAve.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-10  |  426 b   |  23 lines

  1. /* table() version of loadave() suggested by Morris Meyer (mmeyer@next.com) */
  2.  
  3. #include <c.h>
  4. #include <sys/table.h>
  5.  
  6. #define QUEUES 3
  7.  
  8. extern int table();
  9.  
  10. int loadave(long vector[QUEUES])
  11. {
  12.     struct tbl_loadavg tl;
  13.     int i;
  14.  
  15.     if(table(TBL_LOADAVG, 0, &tl, 1, sizeof(tl)) == CERROR) return(CERROR);
  16.  
  17.     if(tl.tl_lscale == 0) return(CERROR);
  18.  
  19.     for (i = 0; i < QUEUES; i++) vector[i] = tl.tl_avenrun[i];
  20.  
  21.     return(tl.tl_lscale);
  22. }
  23.